package mouseEvents;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.RenderingHints;

import javax.swing.JComponent;

public class Line extends JComponent{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
 * 
/**/
//private static final long serialVersionUID = 1L;
	public int x1;
	public int x2;
	public int y1;
	public int y2;
	public Line(int x1,int x2,int y1,int y2){
		this.x1 = x1;
		this.x2 = x2;
		this.y1 = y1;
		this.y2 = y2;
	}
	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		 Graphics2D g2d = (Graphics2D) g;
         Paint p = g2d.getPaint();
         // compensating previous paint
         
         g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         BasicStroke pen1 = new BasicStroke(5);
 		g2d.setStroke(pen1);
	g2d.setColor(Color.blue);
	g2d.drawLine(x1, x2, y1, y2);
	g2d.setPaintMode();
	g2d.setPaint(p);
	
	}
	
	
}
